﻿<div id="alibar" class="fd-clr">
    <div id="alibar-v4">
        <div class="alibar-container">
            <div class="account-sign-status">
                <ul>
                    <li class="account-welcome">您好，<span class="account-id">欢迎来到文化徽商！</span></li>
                </ul>
            </div>
            <div class="topnav">
                <ul>
                    <li>
                        <div class="nav-title">
                            <a rel="nofollow" id="setHomepage" href="#" title="设为首页" data-trace="cn_alibar_myali_fav">设为首页</a>
                        </div>
                    </li>
                    <li>
                        <div class="nav-title">
                            <a rel="nofollow" id="addfavorite" href="#" title="添加收藏" data-trace="cn_alibar_myali_fav">添加收藏</a>
                        </div>
                    </li>
                </ul>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    function setHomepage() {
        if (document.all) {
            document.body.style.behavior = 'url(#default#homepage)';
            document.body.setHomePage(location.href);

        } else if (window.sidebar) {
            if (window.netscape) {
                try {
                    netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
                }
                catch (e) {
                    alert("该操作被浏览器拒绝，如果想启用该功能，请在地址栏内输入 about:config,然后将项 signed.applets.codebase_principal_support 值该为true");
                }
            }
            var prefs = Components.classes['@@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
            prefs.setCharPref('browser.startup.homepage', location.href);
        } else {
            alert('您的浏览器不支持自动设置首页, 请使用手动设置!'); 
        }
}


function addfavorite() {
    if (document.all) {
        window.external.addFavorite(location.href, '文化徽商');
    }
    else if (window.sidebar) {
        window.sidebar.addPanel('文化徽商', location.href, "");
    } else {
        alert("请使用 Ctrl + D ");
    }
}
$(function () {
    $("#addfavorite").click(function (e) {
        addfavorite();
    });
    $("#setHomepage").click(function (e) {
        setHomepage();
    });

});
</script>
